{% extends 'backstage/teacher/base.html' %}

{% block title %}Overview{% endblock %}

{% block setting_content %}
    <div class="card w-100">
        <h4 class="card-header">
            {{ _('Progress') }}
            {% if is_start() and task_all is number %}
                <small class="text-muted">{{ task_finished }} / {{ task_all }}</small>
            {% endif %}
        </h4>
        {% if is_start() %}
            {% if task_all is number %}
                {% if task_all > 0 %}
                    <div class="card-body">
                        <div class="progress">
                            {% set progress = task_finished / task_all * 100 %}
                            <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
                                 style="width: {{ progress|default(0) }}%">
                                {{ _('Finished') }}: {{ '%0.2f'|format(progress|float)|default(0) }}%
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <div class="float-right">
                            {% if task_finished == 0 %}
                                <a class="btn btn-info" href="{{ url_for('teacher.manage_task') }}">
                                    {{ _('Start') }}
                                </a>
                            {% elif 0 < task_finished < task_all %}
                                <a class="btn btn-primary" href="{{ url_for('teacher.manage_task') }}">
                                    {{ _('Contiue') }}
                                </a>
                            {% else %}
                                <a class="btn btn-success" href="{{ url_for('teacher.manage_task') }}">
                                    {{ _('Done') }}
                                </a>
                            {% endif %}
                        </div>
                    </div>
                {% else %}
                    {% include "backstage/tips/no_task.html" %}
                {% endif %}
            {% else %}
                {% include "backstage/tips/no_solution.html" %}
            {% endif %}
        {% else %}
            {% include "backstage/tips/no_start.html" %}
        {% endif %}
    </div>
{% endblock %}
